# Contributor: Michael Jeanson <mjeanson@efficios.com>
# Maintainer: Michael Jeanson <mjeanson@efficios.com>
pkgname=babeltrace
pkgver=2.0.5
pkgrel=1
pkgdesc="Trace converter and read/write library"
url="https://www.efficios.com/babeltrace"
arch="all"
license="MIT"
depends_dev="glib-dev"
makedepends="$depends_dev python3-dev py3-setuptools swig"
checkdepends="bash grep"  # test cases use both Bash and grep tools
subpackages="$pkgname-dev $pkgname-doc py3-$pkgname-pyc py3-babeltrace:py3bindings"
source="https://www.efficios.com/files/babeltrace/babeltrace2-$pkgver.tar.bz2
	gcc12.patch
	fix-test_message_iterator.py-hangs-on-Python-3.12.patch
	"
builddir="$srcdir/babeltrace2-$pkgver"

prepare() {
	default_prepare
	update_config_sub
}

build() {
	# This package uses _init functions to initialise extensions. With
	# --as-needed this will not work.
	export LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static \
		--disable-debug-info \
		--enable-python-bindings \
		--enable-python-plugins \
		--disable-Werror
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	python3 -m compileall -fq "$pkgdir"/usr/lib/python*
}

py3bindings() {
	amove usr/lib/python3*
}

sha512sums="
63469cb0796c720b18bfc09569875eb9a44d2f8a776228bfa503af8ba613b2988b2d20be870f41451e5d6146a3dfb08de6284131d25f1a86137deb75c3a4d514  babeltrace2-2.0.5.tar.bz2
23ccf456450ce7146eb5747ece63e6f7443b77e7a107be0a6b86fd074130cb1a46b4c92b3983e46ae6ee7761203575d24d5e9d4ea4d489789b78ebd29905c585  gcc12.patch
3f4e7117df32045cdfe72be00d95ff9b4aa06066b194193c36f58b552fac8da18d3cdd4b120b2feb3d086ce1019f2824a68275c79b6a76c800f7ced74b5e5d32  fix-test_message_iterator.py-hangs-on-Python-3.12.patch
"
